package com.medicine.model;

import java.io.Serializable;

import javax.enterprise.inject.Model;
import javax.persistence.*;

import java.util.List;


/**
 * The persistent class for the sub_category database table.
 * 
 */
@Entity
@Table(name="sub_category")
@NamedQuery(name="SubCategory.findAll", query="SELECT s FROM SubCategory s")
@Model
public class SubCategory implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private int id;

	@Lob
	@Column(name="main_solution")
	private String mainSolution;

	@Column(name="sub_cate_name")
	private String subCateName;

	//bi-directional many-to-one association to DetailCategory
	@OneToMany(mappedBy="subCategory")
	private List<DetailCategory> detailCategories;

	//bi-directional many-to-one association to IllnessCategory
	@ManyToOne
	@JoinColumn(name="illness_category_id")
	private IllnessCategory illnessCategory;

	public SubCategory() {
	}

	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getMainSolution() {
		return this.mainSolution;
	}

	public void setMainSolution(String mainSolution) {
		this.mainSolution = mainSolution;
	}

	public String getSubCateName() {
		return this.subCateName;
	}

	public void setSubCateName(String subCateName) {
		this.subCateName = subCateName;
	}

	public List<DetailCategory> getDetailCategories() {
		return this.detailCategories;
	}

	public void setDetailCategories(List<DetailCategory> detailCategories) {
		this.detailCategories = detailCategories;
	}

	public DetailCategory addDetailCategory(DetailCategory detailCategory) {
		getDetailCategories().add(detailCategory);
		detailCategory.setSubCategory(this);

		return detailCategory;
	}

	public DetailCategory removeDetailCategory(DetailCategory detailCategory) {
		getDetailCategories().remove(detailCategory);
		detailCategory.setSubCategory(null);

		return detailCategory;
	}

	public IllnessCategory getIllnessCategory() {
		return this.illnessCategory;
	}

	public void setIllnessCategory(IllnessCategory illnessCategory) {
		this.illnessCategory = illnessCategory;
	}

}